package com.bussiness.xutai.service.impl;

import com.bussiness.xutai.bean.Product;
import com.bussiness.xutai.mapper.ProductMapper;
import com.bussiness.xutai.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductMapper productMapper;

    @Override
    public List<Product> getAll() {
        return productMapper.selectAll();
    }

    @Override
    public Product getById(Product product) {
        return productMapper.queryById(product);
    }

    @Override
    public boolean updateProduct(Product product) {
        return productMapper.updateById(product);
    }

    @Override
    public boolean saveProduct(Product product) {
        return productMapper.insertAll(product);
    }

    @Override
    public boolean removeProduct(Product product) {
        return productMapper.deleteById(product);
    }

    @Override
    public int getCount() {
        return productMapper.selectCount();
    }

    @Override
    public List<Product> getSize(int start, int size) {
        return productMapper.selectSize(start,size);
    }
}
